{% extends base %}

{% block head %}
<style type="text/css">
p {
    margin: 0px;
}
</style>
{% end %}

{% block body %}

{% init action = "" %}
{% init index_size = 0 %}

<div class="card">
    <div class="card-title">
        <span>文件索引</span>

        <div class="float-right">
            {% include common/button/back_button.html %}
        </div>
    </div>
</div>

<div class="card">
    <p>索引数量: {{index_size}}</p>

    {% if action == "reindex" %}
    <p>重建索引耗时: {{"%.2f"%cost}}秒</p>
    {% end %}
    
    <div class="row">
        <form method="POST">
            <input type="hidden" name="action" value="reindex">
            <button>重建索引</button>
        </form>
    </div>
</div>

<div class="card">
    <div class="card-title">
        <span>索引目录</span>
    </div>

    <form method="POST">
        <textarea name="index_config" class="row" rows=10>{{"\n".join(index_dirs)}}</textarea>
        <input type="hidden" name="action" value="config">
        <button>更新索引目录</button>
    </form>
</div>

{% end %}